﻿
/*----------------------------------------------------------------//
// 文件名：MoCoTestItem.cs
// 文件功能描述：实体 MoCoTestItem.
// 
// 创建标识：2009-08-11
//
// 修改标识：
// 修改描述：
//----------------------------------------------------------------*/
#region MoCoTestItem
using System;
using System.Data;
using System.Globalization;
using System.Text;
using System.Xml;
using System.Data.Common;
namespace EQT.Model
{
	/// <summary>
	/// 业务实体MoCoTestItem
	/// </summary>
	public partial class MoCoTestItem:ICloneable
	{
		#region 表CoTestItem的字段
		private string _co_item_id;
		private string _report_id;
		private string _item_code;
		private string _item_title;
		private string _test_parameters;
		private decimal _price;
		private string _charge_dept_code;
		private DateTime _sample_rev_date;
		private string _charge_master;
		private DateTime _task_assign_date;
		private DateTime _test_begin_date;
		private DateTime _test_finish_date;
		private int _test_status;
		private DateTime _last_status_time;
		#endregion
		
		#region 构造函数
		public MoCoTestItem()
		{		    
		    _sample_rev_date= new DateTime(1900,1,1);
            _task_assign_date = new DateTime(1900, 1, 1);
            _test_begin_date = new DateTime(1900, 1, 1);
            _test_finish_date = new DateTime(1900, 1, 1);
            _last_status_time = new DateTime(1900, 1, 1);
		}
		#endregion
		
		#region 拷贝构造函数

		public MoCoTestItem(MoCoTestItem item)
		{
			item.CopyTo(this);
		}
		#endregion
		
		#region 带参数构造函数
	    public MoCoTestItem(string co_item_id,string report_id,string item_code,string item_title,string test_parameters,decimal price,string charge_dept_code,DateTime sample_rev_date,string charge_master,DateTime task_assign_date,DateTime test_begin_date,DateTime test_finish_date,int test_status,DateTime last_status_time)
		{
		this._co_item_id=co_item_id;
		this._report_id=report_id;
		this._item_code=item_code;
		this._item_title=item_title;
		this._test_parameters=test_parameters;
		this._price=price;
		this._charge_dept_code=charge_dept_code;
		this._sample_rev_date=sample_rev_date;
		this._charge_master=charge_master;
		this._task_assign_date=task_assign_date;
		this._test_begin_date=test_begin_date;
		this._test_finish_date=test_finish_date;
		this._test_status=test_status;
		this._last_status_time=last_status_time;
		}
		#endregion
		
		#region 表CoTestItem的字段属性
		/// <summary>
		/// CO_ITEM_ID
		/// </summary>
		public string Co_Item_Id
		{
			get {return _co_item_id;}
			set {_co_item_id=value;}
		}
		/// <summary>
		///编号规则为NO. LDYYMMXXX，其中NO.LD为固定前缀，YY表示年份，MM代表月份，XXX代表当月第几个报告。XXX为业务组手工录入。此编号不能重复。报告编号做为唯一值编号贯穿于整个系统流程（包括财务、业务、试验、报告等各部门）
		/// </summary>
		public string Report_Id
		{
			get {return _report_id;}
			set {_report_id=value;}
		}
		/// <summary>
		/// ITEM_CODE
		/// </summary>
		public string Item_Code
		{
			get {return _item_code;}
			set {_item_code=value;}
		}
		/// <summary>
		/// ITEM_TITLE
		/// </summary>
		public string Item_Title
		{
			get {return _item_title;}
			set {_item_title=value;}
		}
		/// <summary>
		/// TEST_PARAMETERS
		/// </summary>
		public string Test_Parameters
		{
			get {return _test_parameters;}
			set {_test_parameters=value;}
		}
		/// <summary>
		/// PRICE
		/// </summary>
		public decimal Price
		{
			get {return _price;}
			set {_price=value;}
		}
		/// <summary>
		/// CHARGE_DEPT_CODE
		/// </summary>
		public string Charge_Dept_Code
		{
			get {return _charge_dept_code;}
			set {_charge_dept_code=value;}
		}
		/// <summary>
		/// SAMPLE_REV_DATE
		/// </summary>
		public DateTime Sample_Rev_Date
		{
			get {return _sample_rev_date;}
			set {_sample_rev_date=value;}
		}
		/// <summary>
		/// CHARGE_MASTER
		/// </summary>
		public string Charge_Master
		{
			get {return _charge_master;}
			set {_charge_master=value;}
		}
		/// <summary>
		///将计划执行日期改成任务下发日期
		/// </summary>
		public DateTime Task_Assign_Date
		{
			get {return _task_assign_date;}
			set {_task_assign_date=value;}
		}
		/// <summary>
		/// TEST_BEGIN_DATE
		/// </summary>
		public DateTime Test_Begin_Date
		{
			get {return _test_begin_date;}
			set {_test_begin_date=value;}
		}
		/// <summary>
		/// TEST_FINISH_DATE
		/// </summary>
		public DateTime Test_Finish_Date
		{
			get {return _test_finish_date;}
			set {_test_finish_date=value;}
		}
		/// <summary>
		///0=无效，1=未开始，2=进行中，3=已完成
		/// </summary>
		public int Test_Status
		{
			get {return _test_status;}
			set {_test_status=value;}
		}
		/// <summary>
		/// LAST_STATUS_TIME
		/// </summary>
		public DateTime Last_Status_Time
		{
			get {return _last_status_time;}
			set {_last_status_time=value;}
		}
		#endregion
		
		#region 辅助函数
		/// <summary>
		/// 拷贝函数
		/// </summary>
		public MoCoTestItem CopyTo(MoCoTestItem item)
        {
		    item.Co_Item_Id=this.Co_Item_Id;
		    item.Report_Id=this.Report_Id;
		    item.Item_Code=this.Item_Code;
		    item.Item_Title=this.Item_Title;
		    item.Test_Parameters=this.Test_Parameters;
		    item.Price=this.Price;
		    item.Charge_Dept_Code=this.Charge_Dept_Code;
		    item.Sample_Rev_Date=this.Sample_Rev_Date;
		    item.Charge_Master=this.Charge_Master;
		    item.Task_Assign_Date=this.Task_Assign_Date;
		    item.Test_Begin_Date=this.Test_Begin_Date;
		    item.Test_Finish_Date=this.Test_Finish_Date;
		    item.Test_Status=this.Test_Status;
		    item.Last_Status_Time=this.Last_Status_Time;
			return item;
        }
		/// <summary>
		/// 克隆函数
		/// </summary>		
		public object Clone()
        {
            MoCoTestItem NewCoTestItem=new MoCoTestItem();
		    NewCoTestItem._co_item_id=this._co_item_id;
		    NewCoTestItem._report_id=this._report_id;
		    NewCoTestItem._item_code=this._item_code;
		    NewCoTestItem._item_title=this._item_title;
		    NewCoTestItem._test_parameters=this._test_parameters;
		    NewCoTestItem._price=this._price;
		    NewCoTestItem._charge_dept_code=this._charge_dept_code;
		    NewCoTestItem._sample_rev_date=this._sample_rev_date;
		    NewCoTestItem._charge_master=this._charge_master;
		    NewCoTestItem._task_assign_date=this._task_assign_date;
		    NewCoTestItem._test_begin_date=this._test_begin_date;
		    NewCoTestItem._test_finish_date=this._test_finish_date;
		    NewCoTestItem._test_status=this._test_status;
		    NewCoTestItem._last_status_time=this._last_status_time;
			return NewCoTestItem;
		}
		
		private static MoCoTestItem _empty = new MoCoTestItem(string.Empty,string.Empty,string.Empty,string.Empty,string.Empty,0,string.Empty,DateTime.MinValue,string.Empty,DateTime.MinValue,DateTime.MinValue,DateTime.MinValue,-1,DateTime.MinValue);
        public static MoCoTestItem Empty
        {
            get
            {
                return _empty;
            }
        }
		
		///<summary>
		///判断对象是否相等
		///<summary>
		public override bool Equals(object obj)
        {
            if (base.Equals(obj))
            {
                return true;
            }
            else
            {
                MoCoTestItem NewCoTestItem = obj as MoCoTestItem;
                if (NewCoTestItem == null)
                {
                    return false;
                }
                else
                {
				if (NewCoTestItem.Co_Item_Id==this.Co_Item_Id && NewCoTestItem.Report_Id==this.Report_Id && NewCoTestItem.Item_Code==this.Item_Code && NewCoTestItem.Item_Title==this.Item_Title && NewCoTestItem.Test_Parameters==this.Test_Parameters && NewCoTestItem.Price==this.Price && NewCoTestItem.Charge_Dept_Code==this.Charge_Dept_Code && NewCoTestItem.Sample_Rev_Date==this.Sample_Rev_Date && NewCoTestItem.Charge_Master==this.Charge_Master && NewCoTestItem.Task_Assign_Date==this.Task_Assign_Date && NewCoTestItem.Test_Begin_Date==this.Test_Begin_Date && NewCoTestItem.Test_Finish_Date==this.Test_Finish_Date && NewCoTestItem.Test_Status==this.Test_Status && NewCoTestItem.Last_Status_Time==this.Last_Status_Time)		
					{
                        return true; 
                    }
                }

            }
            return false;
            
        }
		///TODO:you should modify GetHashCode by yourself.
		public override int GetHashCode()
		{
			return base.GetHashCode();
		} 

		public override string ToString()
        {
		   return String.Format("Co_Item_Id={0}/Report_Id={1}/Item_Code={2}/Item_Title={3}/Test_Parameters={4}/Price={5}/Charge_Dept_Code={6}/Sample_Rev_Date={7}/Charge_Master={8}/Task_Assign_Date={9}/Test_Begin_Date={10}/Test_Finish_Date={11}/Test_Status={12}/Last_Status_Time={13}",_co_item_id,_report_id,_item_code,_item_title,_test_parameters,_price,_charge_dept_code,_sample_rev_date,_charge_master,_task_assign_date,_test_begin_date,_test_finish_date,_test_status,_last_status_time);
		 
		}
		#endregion
		
		#region DataTable Help Function
		///<summary>
		///DataRow转换成Model
		///</summary>
		public void Row2Model(DataRow row)
		{
		    if(row["Co_Item_ID"]!=null && row["Co_Item_ID"]!=DBNull.Value)
			{
			    this.Co_Item_Id = (string)row["Co_Item_ID"];
			}
			else
			{
				this.Co_Item_Id =string.Empty;
			}
		    if(row["Report_ID"]!=null && row["Report_ID"]!=DBNull.Value)
			{
			    this.Report_Id = (string)row["Report_ID"];
			}
			else
			{
				this.Report_Id =string.Empty;
			}
		    if(row["Item_Code"]!=null && row["Item_Code"]!=DBNull.Value)
			{
			    this.Item_Code = (string)row["Item_Code"];
			}
			else
			{
				this.Item_Code =string.Empty;
			}
		    if(row["Item_Title"]!=null && row["Item_Title"]!=DBNull.Value)
			{
			    this.Item_Title = (string)row["Item_Title"];
			}
			else
			{
				this.Item_Title =string.Empty;
			}
		    if(row["Test_Parameters"]!=null && row["Test_Parameters"]!=DBNull.Value)
			{
			    this.Test_Parameters = (string)row["Test_Parameters"];
			}
			else
			{
				this.Test_Parameters =string.Empty;
			}
		    if(row["Price"]!=null && row["Price"]!=DBNull.Value)
			{
			    this.Price = (decimal)row["Price"];
			}
			else
			{
				this.Price =0;
			}
		    if(row["Charge_Dept_Code"]!=null && row["Charge_Dept_Code"]!=DBNull.Value)
			{
			    this.Charge_Dept_Code = (string)row["Charge_Dept_Code"];
			}
			else
			{
				this.Charge_Dept_Code =string.Empty;
			}
		    if(row["Sample_Rev_Date"]!=null && row["Sample_Rev_Date"]!=DBNull.Value)
			{
			    this.Sample_Rev_Date = (DateTime)row["Sample_Rev_Date"];
			}
			else
			{
				this.Sample_Rev_Date =DateTime.MinValue;
			}
		    if(row["Charge_Master"]!=null && row["Charge_Master"]!=DBNull.Value)
			{
			    this.Charge_Master = (string)row["Charge_Master"];
			}
			else
			{
				this.Charge_Master =string.Empty;
			}
		    if(row["Task_Assign_Date"]!=null && row["Task_Assign_Date"]!=DBNull.Value)
			{
			    this.Task_Assign_Date = (DateTime)row["Task_Assign_Date"];
			}
			else
			{
				this.Task_Assign_Date =DateTime.MinValue;
			}
		    if(row["Test_Begin_Date"]!=null && row["Test_Begin_Date"]!=DBNull.Value)
			{
			    this.Test_Begin_Date = (DateTime)row["Test_Begin_Date"];
			}
			else
			{
				this.Test_Begin_Date =DateTime.MinValue;
			}
		    if(row["Test_Finish_Date"]!=null && row["Test_Finish_Date"]!=DBNull.Value)
			{
			    this.Test_Finish_Date = (DateTime)row["Test_Finish_Date"];
			}
			else
			{
				this.Test_Finish_Date =DateTime.MinValue;
			}
		    if(row["Test_Status"]!=null && row["Test_Status"]!=DBNull.Value)
			{
			    this.Test_Status = (int)row["Test_Status"];
			}
			else
			{
				this.Test_Status =-1;
			}
		    if(row["Last_Status_Time"]!=null && row["Last_Status_Time"]!=DBNull.Value)
			{
			    this.Last_Status_Time = (DateTime)row["Last_Status_Time"];
			}
			else
			{
				this.Last_Status_Time =DateTime.MinValue;
			}
		}
		
		///<summary>
		///Model转换成DataRow
		///</summary>
	　　public void Model2Row(DataRow row)
		{
			row["Co_Item_ID"] = this.Co_Item_Id;
			row["Report_ID"] = this.Report_Id;
			row["Item_Code"] = this.Item_Code;
			row["Item_Title"] = this.Item_Title;
			row["Test_Parameters"] = this.Test_Parameters;
			row["Price"] = this.Price;
			row["Charge_Dept_Code"] = this.Charge_Dept_Code;
			row["Sample_Rev_Date"] = this.Sample_Rev_Date;
			row["Charge_Master"] = this.Charge_Master;
			row["Task_Assign_Date"] = this.Task_Assign_Date;
			row["Test_Begin_Date"] = this.Test_Begin_Date;
			row["Test_Finish_Date"] = this.Test_Finish_Date;
			row["Test_Status"] = this.Test_Status;
			row["Last_Status_Time"] = this.Last_Status_Time;
		}
		#endregion
	}
}
#endregion
